#include <iostream>
#include <netpp/socket>
#include <netpp/except>

int
main(int argc, char **argv)
{
    using namespace std;
    using namespace netpp;

    Socket *s;
    string get, host, put;
    int port;

    try
    {
        host = "www.google.com";
        port = 80;
        put= "GET /pda HTTP/1.0\r\nHost:" +host+"\r\nAccept: text/html, text/plain, text/css, text/sgml, */*;q=0.01\r\nAccept-Language: en\r\nUser-Agent: hl7libpp v0.3r26\r\n\r\n";
        s = new Socket(host);

        if(!s->connect(host, port))
            cout << "connect failed"<<endl;

        if(!s->send(put))
            cout << "send failed"<<endl;

        if(!s->recv(get))
            cout << "recv failed"<<endl;

        cout << get << endl;
        delete s;
    }
    catch(Exception &e)
    {
        cout << e.what() << endl;
        return EXIT_FAILURE;
    }

    return EXIT_SUCCESS;
}
